package pshycomanagement

class Security {

     String userName
    String password
    String securityLevel
    String password2
    
    //static belongsto = [user : User] 
    
    static constraints = {
        userName blank:false, unique: true
           
     password(blank: false, nullable: false, size:5..20, password:true,  validator: {password, obj ->
         def password2 = obj.properties['password2']
         if(password2 == null) return true 
         password2 == password ? true : ['invalid.matchingpasswords']  
     })
    password2 blank:false, nullable:false, password:true 
        securityLevel inList:["User","Admin"], blank: false 
     
 }
 String toString() {
        "${userName}"
    }
}
